using System;
using System.Collections.Generic;
using System.Text;
using QLKS.HeThongBUS;
using System.Data;
using System.Data.OleDb;
using QLKS.HeThongDAO;

namespace QLKS.HeThongDAO
{
    class DV_DAO
    {
        public static DataTable SelectAllLoaiDV()
        {
            string sql = "SELECT MaDichVu as [Mã Dịch Vụ],TenDichVu as [Tên Dịch Vụ], GiaDichVu as [Giá Dịch Vụ] FROM DichVu";
            return Config.AccessHelper.ExecuteQuery(sql);
        }

               
      

        public static bool Insert(DV_DTO ldv)
        {
            try
            {
                
                string sql = "INSERT INTO DichVu(TenDichVu,GiaDichVu) VALUES ('" +
                ldv.TenDV + "','" +ldv.GiaDV + "')";  
                Config.AccessHelper.ExecuteNonQuery(sql);
                return true;
            }
            catch
            {
                return false;
            }
        }

        public static bool UpdateDV(DV_DTO DV)
        {
            try
            {
                string sql = "UPDATE DichVu SET MaDV = '" + DV.GiaDV + "',TenDichVu = '" + DV.TenDV + "',GiaDichVu = '" + DV.GiaDV ;
                Config.AccessHelper.ExecuteNonQuery(sql);
                return true;
            }
            catch
            {
                return false;
            }
        }

         public static bool DeleteDV(DV_DTO DV)
        {
            try
            {
                string sql = "DELETE FROM DichVu WHERE MaDichVu=" + DV.MaDV;
                Config.AccessHelper.ExecuteNonQuery(sql);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
